﻿using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLevy.UI.Utils
{
    public class Backups
    {

        public Backups()
        {

        }


        public static Boolean CrearBackup()
        {
            bool resultado = true;

            string backup = AppDomain.CurrentDomain.BaseDirectory + "LEVY - " + DateTime.Now.ToShortDateString().Replace('/', '-') + ".sql";

            try
            {
                using (MySqlConnection conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["LEVYDB"].ToString()))
                {
                    using (MySqlCommand cmd = new MySqlCommand())
                    {
                        //using (MySqlBackup mb = new MySqlBackup(cmd))
                        //{
                        //    cmd.Connection = conn;
                        //    conn.Open();
                        //    mb.ExportToFile(backup);
                        //    conn.Close();

                        //    return resultado;
                        //}

                        throw new NotImplementedException();
                    }
                }
                
            }
            catch (Exception e)
            {
                resultado = false;                             
                return resultado;
                throw e;
            }
        }
    }
}
